home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Mag HDD Backup
/
Amiga Mag HDD Backup.zip
/
Amiga Mag HDD Backup
/
Alexander.img.bin
/
Alexander.img
/
tech 4.1 editorial Archive.sit
/
Iovine
/
life
(
.txt
)
< prev
Wrap
AmigaBASIC Source Code
|
1993-06-18
|
1KB
|
39 lines
REM John Iovine
REM Game of Life
DIM OL(24,70), NE(24,70) : GN = 0
CLS
GOSUB Start ' input pattern
display:
LOCATE 1,1 : REM PRINT CHR$(11);
FOR I = 1 TO 22: FOR C = 1 TO 69
IF NE(I,C) = 0 THEN PRINT CHR$(32);::ELSE PRINT CHR$(31);
OL(I,C) = NE(I,C)
NEXT C: PRINT: NEXT I
PRINT "Generation"; GN; : GN = GN + 1
FOR I = 1 TO 22 : FOR C = 1 TO 69
N = 0 : CN = OL(I,C)
IF OL(I-1,C-1) = 1 THEN N = N + 1
IF OL(I-1,C) = 1 THEN N = N + 1
IF OL(I-1,C+1) = 1 THEN N = N + 1
IF OL(I,C-1) = 1 THEN N = N + 1
IF OL(I,C+1) = 1 THEN N = N + 1
IF OL(I+1,C-1) = 1 THEN N = N + 1
IF OL(I+1,C) = 1 THEN N = N + 1
IF OL(I+1,C+1) = 1 THEN N = N + 1
IF N < 2 THEN NE(I,C) = 0
IF N = 3 THEN NE(I,C) = 1
IF N = 4 THEN NE(I,C) = 0
IF N > 4 THEN NE(I,C) = 0
NEXT C: NEXT I
GOTO display: REM return to display
Start:
REM Enter Starting Pattern
NE(12,31) = 1
NE(12,32) = 1
NE(12,33) = 1
NE(13,30) = 1
NE(13,33) = 1
NE(14,29) = 1
NE(14,33) = 1
RETURN